/**
 * 对话消息API
 */

import { http } from '@/utils/request'
import type { Message, SendMessageRequest } from '@/types/chat'

// 获取聊天记录
export const getChatHistory = (characterId: number, userId: number, page: number = 1, size: number = 20) => 
  http.get<Message[]>(`/conversations/${characterId}?userId=${userId}&page=${page}&size=${size}`)

// 发送消息并获取AI回复
export const sendMessage = (data: SendMessageRequest, userId: number) => 
  http.post<Message>(`/conversations/send?userId=${userId}`, data)

// 更新消息状态
export const updateMessageStatus = (messageId: number, status: string) => 
  http.put<void>(`/messages/${messageId}/status?status=${status}`)

